package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.math.BigDecimal;

public class OrderHardware implements Serializable {

	private static final long serialVersionUID = 5453587439016112665L;
	
	private Long id;
	private Long hardwareId;
	
	private String hardwareName;
	
	private BigDecimal price;
	private int num;
	private Value hardwareType;
	private String rsv1;
	private String rsv2;
	private String rsv3;

	private int supplierid;



	public OrderHardware(Long hardwareId,String hardwareName,BigDecimal price,int number,Value type,int supplierid)
	{
		this.hardwareId=hardwareId;
		this.hardwareName=hardwareName;
		this.price=price;
		this.num=number;
		this.hardwareType=type;
		this.supplierid=supplierid;
	}
	public void incrementByInt(int number)
	{
		this.num=this.num+number;
	}
	public boolean equals(Object obj)
	{
		if(this==obj) return true;
		if(!(obj instanceof OrderHardware))
			return false;
		OrderHardware target=(OrderHardware)obj;
		//都包含id就比较
		if(this.getId()!=null&&target.getId()!=null)
		{
			return this.getId().equals(target.getId());
		}
		//两个中有一个为空,或都空
		
			
	    if(this.getHardwareId().equals(this.getHardwareId())&&this.getHardwareType().equals(this.getHardwareType()))
	    {
	    	return true;
	    }
		
		return false;
	}

	public int hashCode()
	{
		int result=17;
		if(this.getId()!=null)
		{
			result=37*result+this.getId().hashCode();
		}
		
		if(this.getHardwareId()!=null)
		{
			result=37*result+this.getHardwareId().hashCode();
		}
		
		if(this.getHardwareType()!=null)
		{
			result=37*result+this.getHardwareType().hashCode();
		}
		return result;
	}
	public OrderHardware() {
		// TODO Auto-generated constructor stub
	}

	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public String getHardwareName() {
		return hardwareName;
	}

	public void setHardwareName(String hardwareName) {
		this.hardwareName = hardwareName;
	}

	public Long getHardwareId() {
		return hardwareId;
	}

	public void setHardwareId(Long hardwareId) {
		this.hardwareId = hardwareId;
	}

	public Value getHardwareType() {
		return hardwareType;
	}

	public void setHardwareType(Value hardwareType) {
		this.hardwareType = hardwareType;
	}

	public String getRsv1() {
		return rsv1;
	}

	public void setRsv1(String rsv1) {
		this.rsv1 = rsv1;
	}

	public String getRsv2() {
		return rsv2;
	}

	public void setRsv2(String rsv2) {
		this.rsv2 = rsv2;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}
	public int getSupplierid() {
		return supplierid;
	}
	public void setSupplierid(int supplierid) {
		this.supplierid = supplierid;
	}




}
